$(function () {
    //======================
    //======设置查询条件========
    //======================
    //物资大类wzdl
    $("#bgjhywk_toolbar [name='wzdl']").yjwzbmCombobox();
    //计划年份
    $("#bgjhywk_toolbar [name='jhnf']").numberspinner({
        min:2000,
        max:2100,
        editable:true
    });
    //计划月份
    $("#bgjhywk_toolbar [name='jhyf']").numberspinner({
        min:1,
        max:12,
        editable:true
    });
    //计划单位
    $("#bgjhywk_toolbar [name='jhdwId']").ljsxyCombobox({lx:3, sxy:"xy", jyjg:$("#bgjhywk_toolbar [name='zgsId']").val()});
    //搜索按钮
    $("#bgjhywk_toolbar [name='searchButton']").click(function () {
        var frozenColumns = frozenwcColumns;
        var col = wclColumns;
        var status = $("#bgjhywk_toolbar [name='status']").val();
        switch (status) {
            case "1":
                frozenColumns = frozenwcColumns;
                col = wclColumns;
                break;
            case "2":
                frozenColumns = frozenyblColumns;
                col = yblColumns;
                break;
            case "3":
                frozenColumns = frozenygqColumns;
                col = ygqColumns;
                break;
            case "4":
                frozenColumns = frozenythColumns;
                col = ythColumns;
                break;
        }
        $(grid).edatagrid({
            frozenColumns:frozenColumns,
            columns:col,
            queryParams:{
                status:$("#bgjhywk_toolbar [name='status']").val(),
                wzdl:$("#bgjhywk_toolbar [name='wzdl']").val(),
                jhdwId:$("#bgjhywk_toolbar [name='jhdwId']").val(),
                jhnf:$("#bgjhywk_toolbar [name='jhnf']").val(),
                jhyf:$("#bgjhywk_toolbar [name='jhyf']").val(),
                wzbm:$("#bgjhywk_toolbar [name='wzbm']").val(),
                sm:$("#bgjhywk_toolbar [name='sm']").val(),
                startDate:$("#bgjhywk_toolbar [name='startDate']").val(),
                endDate:$("#bgjhywk_toolbar [name='endDate']").val(),
                ywksbcl:$("#ywksbcl").combobox("getValue")
            }});
    });
    //======================
    //========操作按钮========
    //=====================

//    $('#bgjhywk_toolbar [name="jhcl"]').click(function () {
//        var rows = $(grid).edatagrid('getChecked');
//        if (rows.length > 0) {
//            $.messager.confirm('提示', '是否处理或退回计划?', function (r) {
//                if (r) {
//                    //结束编辑列的编辑状态
//                    $(grid).edatagrid("saveRow");
//                    var arrayPrefix = "bgjhhzmxList";
//                    for (var i = 0; i < rows.length; i++) {
//                        var paramString = "{"
//                        var objectString = $.toJSONStringPrefix(rows[i], arrayPrefix + "[" + i + "].");
//                        paramString = paramString + objectString.substring(1, objectString.length - 1) + ",";
//                        paramString = paramString.substring(0, paramString.length - 1) + "}";
//                        var param = $.parseJSON(paramString);
//                        $.mask();
//                        if(rows[i].thyy && rows[i].thyy.trim()!=""){
//                             $.post($.webPath() + "/jhgl/bgjhywk/ywkth", param, function (data) {
//                              $.mask.hide();
//                              if (data.statusCode == 200) {
//                                  $(grid).edatagrid("reload");
//                                  $.messager.show({
//                                   title: '提示',
//                                    msg: data.message,
//                                    timeout: 3000,
//                                    showType: 'slide'
//                                });
//                              } else {
//                                 $.messager.alert('提示', data.message, 'error');
//                              }
//                              });
//                        }else{
//                            $.post($.webPath() + "/jhgl/bgjhywk/ywkcl", param, function (data) {
//                                $.mask.hide();
//                                if (data.statusCode == 200) {
//                                    $(grid).edatagrid("reload");
//                                    $.messager.show({
//                                        title: '提示',
//                                        msg: data.message,
//                                        timeout: 3000,
//                                        showType: 'slide'
//                                    });
//                                } else {
//                                    $.messager.alert('提示', data.message, 'error');
//                                }
//                            });
//                        }
//
//                    }
//                }
//            });
//        } else {
//            $.messager.alert("提示", "请选择要处理的计划!", "waring");
//        }
//    });

//    //计划处理或退回
    $('#bgjhywk_toolbar [name="jhcl"]').click(function () {
        var rows = $(grid).edatagrid('getChecked');
        if (rows.length > 0) {
            $.messager.confirm('提示', '是否确认处理?', function (r) {
                if (r) {
                    //结束编辑列的编辑状态
                    $(grid).edatagrid("saveRow");
                    var arrayPrefix = "bgjhhzmxList";
                    var paramString = "{"
                    for (var i = 0; i < rows.length; i++) {
                        var objectString = $.toJSONStringPrefix(rows[i], arrayPrefix + "[" + i + "].");
                        paramString = paramString + objectString.substring(1, objectString.length - 1) + ",";
                    }
                    paramString = paramString.substring(0, paramString.length - 1) + "}";
                    var param = $.parseJSON(paramString);
                    $.mask();
                    $.post($.webPath() + "/jhgl/bgjhywk/ywkcl", param, function (data) {
                        $.mask.hide();
                        if (data.statusCode == 200) {
                            $(grid).edatagrid("reload");
                            $.messager.show({
                                title:'提示',
                                msg:data.message,
                                timeout:3000,
                                showType:'slide'
                            });
                        } else if (data.statusCode == 301) {
                            $.messager.alert('提示', data.message, 'warnning', function () {
                                $(grid).edatagrid("reload");
                            });
                        } else {
                            $.messager.alert('提示', data.message, 'error');
                        }
                    });
                }
            });
        } else {
            $.messager.alert("提示", "请选择要处理的计划!", "waring");
        }
    });

    //计划延期
    $('#bgjhywk_toolbar [name="jhyq"]').click(function () {
        var rows;
        if ($("#bgjhywk_toolbar [name='status']").val() == 1) {
            rows = $(grid).edatagrid('getChecked');
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 2) {
            rows = $(grid).edatagrid('getSelected');
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 3) {
            rows = $(grid).edatagrid('getSelected');
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 4) {
            rows = $(grid).edatagrid('getSelected');
        } else if ($("#bgjhywk_toolbar [name='status']").val() == -1) {
            rows = $(grid).edatagrid('getChecked');
        }
        if (rows) {
            ywk_jhyq('计划延期', 'ywk_jhyq');
        } else {
            $.messager.alert("提示", "请选择要处理的计划!", "waring");
        }
    });

    function ywk_jhyq(title, action) {
        var href;
        var record;
        if ($("#bgjhywk_toolbar [name='status']").val() == 1) {
            record = $(grid).edatagrid('getChecked');
            $.each(record, function (index, item) {
                href = $.webPath() + "/jhgl/bgjhywk/bgjhywk_yq?mxid=" + item.id;
            });
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 2) {
            record = $(grid).edatagrid('getSelected');
            href = $.webPath() + "/jhgl/bgjhywk/bgjhywk_yq?mxid=" + record.id;
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 3) {
            record = $(grid).edatagrid('getSelected');
            href = $.webPath() + "/jhgl/bgjhywk/bgjhywk_yq?mxid=" + record.id;
        } else if ($("#bgjhywk_toolbar [name='status']").val() == 4) {
            record = $(grid).edatagrid('getSelected');
            href = $.webPath() + "/jhgl/bgjhywk/bgjhywk_yq?mxid=" + record.id;
        } else if ($("#bgjhywk_toolbar [name='status']").val() == -1) {
            record = $(grid).edatagrid('getChecked');
            $.each(record, function (index, item) {
                href = $.webPath() + "/jhgl/bgjhywk/bgjhywk_yq?mxid=" + item.id;
            });
        }
        var actionUrl = $.webPath() + "/jhgl/bgjhywk/" + action;
        ywk_jhyqDialog(title, href, actionUrl);
    }

    function ywk_jhyqDialog(title, href, actionUrl) {
        var win = $.window({
            title:title,
            width:420,
            height:400,
            cache:false,
            url:href,
            modal:true,
            buttons:[
                {
                    text:'保存',
                    handler:function () {
                        $(win).mask();
                        $('#form_bgjhywk_jhyq').form('submit', {
                            url:actionUrl,
                            onSubmit:function () {
                                var isValid = $(this).form('validate');
                                if (!isValid) {
                                    $(win).mask('hide');
                                    return false;
                                }
                                return isValid;
                            },
                            success:function (data) {
                                $(win).mask('hide');
                                var json = $.parseJSON(data);
                                if (json.statusCode == 200) {
                                    $(win).window('close');
                                    $('#bgjhywk_grid').datagrid('reload');
                                    $.messager.show({
                                        title:'提示',
                                        msg:json.message,
                                        timeout:3000,
                                        showType:'slide'
                                    });
                                } else
                                    $.messager.alert('提示', json.message, 'error');
                            }
                        });
                    }
                }
            ]
        });
    }

//======================
//========计划列表========
//======================
    //未处理
    var frozenwcColumns = [
        [
            {field:'checked', title:'选择', checkbox:true},
            {field:'id', title:'ID', hidden:true},
            {field:'wzgg.oldcode', title:'物资编码', align:'center', width:100},
//            {field: 'wzgg.code', title: '物资编码(新)', width: 75},
            {field:'wzgg.name', title:'品种', align:'center', width:100},
            {field:'wzgg.ggxh', title:'规格型号', align:'center', width:110},
            {field:'wzgg.th', title:'图号', align:'center', width:110}
        ]
    ]
    var wclColumns = [
        [
            {field:'jhsl', title:'计划数量', align:'right',
                formatter:function (value) {
                    var sl = formatSl(value, ",");
                    return sl;
                }, width:100},
            {field:'sl1', title:'一级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:150},
            {field:'kcsl', title:'二级可用库存', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:150},
            {field:'sl2', title:'二级平衡数量', width:150, align:'right',
                formatter:function (value) {
                    var sl = formatSl(value, ",");
                    return sl;
                }, editor:{type:'numberbox', options:{min:0, groupSeparator:',', precision:4}}},
            {field:'sbsl', title:'提交数量', width:150, align:'right',
                formatter:function (value) {
                    var sl = formatSl(value, ",");
                    return sl;
                }, editor:{type:'numberbox', options:{min:0, groupSeparator:',', precision:4}}},
            {field:'thyy', title:'退回原因', align:'center', width:100, editor:{type:'text'}},
            {field:'dhrq', title:'到货日期', align:'center', width:100, editor:{type:'datebox'}},
            {field:'createUser.xm', title:'计划员', align:'center', width:100},
            {field:'ph', title:'牌号', align:'center', width:100},
            {title:'设备材料', field:'sbcl', align:'center', formatter:function (value) {
                if (value == 'sb') {
                    return "设备";
                }
                if (value == "cl") {
                    return "材料";
                }
            }, width:100},
            {field:'bz', title:'备注', align:'center', width:100, editor:{type:'text'}},
            {field:'bgjhhz.sm', title:'计划描述', align:'center', width:400},
            {field:'bgjhhz.jhsj', title:'计划日期', align:'center', width:100},
            {field:'gyzclrq', title:'提报日期', align:'center', width:100},
            {field:'gyzclr.xm', title:'提报人', align:'center', width:100},
            {field:'ywkclr.xm', title:'业务科处理人', align:'center', width:100},
            {field:'ywkclrq', title:'业务科处理日期', align:'center', width:100},
            {field:'sfcg', title:'导入状态', align:'center', formatter:function (value) {
                if (value == '0') {
                    return "未导入";
                }
                if (value == "1") {
                    return "已导入";
                }
            }, width:100}
        ]
    ];
    //已办理
    var frozenyblColumns = [
        [
            {field:'id', title:'ID', hidden:true},
            {field:'wzgg.oldcode', title:'物资编码', align:'center', width:100},
//            {field: 'wzgg.code', title: '物资编码(新)', width: 50},
            {field:'wzgg.name', title:'品种', align:'center', width:100},
            {field:'wzgg.ggxh', title:'规格型号', align:'center', width:100},
            {field:'wzgg.th', title:'图号', align:'center', width:100},
            {field:'cgfs', title:'采购方式', align:'center', width:100, formatter:function (value) {
                if (value == 1)
                    return  "比价";
                if (value == 2)
                    return  "招标";
            }}
        ]
    ]
    var yblColumns = [
        [
            {field:'jhsl', title:'计划数量', align:'right', width:100},
            {field:'sl1', title:'一级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'kcsl', title:'二级可用库存', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sl2', title:'二级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sbsl', title:'提交数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'dhrq', title:'到货日期', align:'center', width:100},
            {field:'createUser.xm', title:'计划员', align:'center', width:70},
            {field:'ph', title:'牌号', align:'center', width:100},
            {title:'设备材料', field:'sbcl', align:'center', formatter:function (value) {
                if (value == 'sb') {
                    return "设备";
                }
                if (value == "cl") {
                    return "材料";
                }
            }, width:100},
            {field:'bz', title:'备注', align:'center', width:100},
            {field:'bgjhhz.sm', title:'计划描述', align:'center', width:100},
            {field:'bgjhhz.jhsj', title:'计划日期', align:'center', width:100},
            {field:'gyzclr.xm', title:'提报人', align:'center', width:70},
            {field:'gyzclrq', title:'提报日期', align:'center', width:100},
            {field:'ywkclr.xm', title:'处理人', align:'center', width:70},
            {field:'ywkclrq', title:'处理日期', align:'center', width:100},
            {field:'ywkclr.xm', title:'业务科处理人', align:'center', width:100},
            {field:'ywkclrq', title:'业务科处理日期', align:'center', width:100},
            {field:'sfcg', title:'导入状态', align:'center', formatter:function (value, row, index) {
                if (row.cgfs == 1) {
                    if (value == '0') {
                        return "未导入";
                    }
                    if (value == "1") {
                        return "已导入";
                    }
                } else {
                    return "";
                }
            }, width:100}
        ]
    ];
    //已过期
    var frozenygqColumns = [
        [
            {field:'id', title:'ID', hidden:true},
            {field:'wzgg.oldcode', title:'物资编码', align:'center', width:100},
//            {field: 'wzgg.code', title: '物资编码(新)', width: 50},
            {field:'wzgg.name', title:'品种', align:'center', width:100},
            {field:'wzgg.ggxh', title:'规格型号', align:'center', width:100},
            {field:'wzgg.th', title:'图号', align:'center', width:100},
            {field:'cgfs', title:'采购方式', align:'center', width:100, formatter:function (value) {
                if (value == 1)
                    return  "比价";
                if (value == 2)
                    return  "招标";
            }}
        ]
    ]
    var ygqColumns = [
        [
            {field:'jhsl', title:'计划数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sl1', title:'一级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'kcsl', title:'二级可用库存', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sl2', title:'二级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sbsl', title:'提交数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'dhrq', title:'到货日期', align:'center', width:100},
            {field:'createUser.xm', title:'计划员', align:'center', width:100},
            {field:'ph', title:'牌号', align:'center', width:100},
            {title:'设备材料', field:'sbcl', align:'center', formatter:function (value) {
                if (value == 'sb') {
                    return "设备";
                }
                if (value == "cl") {
                    return "材料";
                }
            }, width:100},
            {field:'bz', title:'备注', align:'center', width:100},
            {field:'bgjhhz.sm', title:'计划描述', align:'center', width:100},
            {field:'bgjhhz.jhsj', title:'计划日期', align:'center', width:100},
            {field:'gyzclrq', title:'提报日期', align:'center', width:100},
            {field:'gyzclr.xm', title:'提报人', align:'center', width:100},
            {field:'ywkclr.xm', title:'业务科处理人', align:'center', width:100},
            {field:'ywkclrq', title:'业务科处理日期', align:'center', width:100},
            {field:'sfcg', title:'导入状态', align:'center', formatter:function (value, row, index) {
                if (row.cgfs == 1) {
                    if (value == '0') {
                        return "未导入";
                    }
                    if (value == "1") {
                        return "已导入";
                    }
                } else {
                    return "";
                }
            }, width:100}
        ]
    ];
    //已退回
    var frozenythColumns = [
        [
            {field:'id', title:'ID', hidden:true},
            {field:'wzgg.oldcode', title:'物资编码', align:'center', width:100},
//            {field: 'wzgg.code', title: '物资编码(新)', width: 50},
            {field:'wzgg.name', title:'品种', align:'center', width:100},
            {field:'wzgg.ggxh', title:'规格型号', align:'center', width:100},
            {field:'wzgg.th', title:'图号', align:'center', width:100},
            {field:'cgfs', title:'采购方式', align:'center', width:100, formatter:function (value) {
                if (value == 1)
                    return  "比价";
                if (value == 2)
                    return  "招标";
            }}
        ]
    ]
    var ythColumns = [
        [
            {field:'jhsl', title:'计划数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sl1', title:'一级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'kcsl', title:'二级可用库存', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sl2', title:'二级平衡数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'sbsl', title:'提交数量', align:'right', formatter:function (value) {
                var sl = formatSl(value, ",");
                return sl;
            }, width:100},
            {field:'thyy', title:'退回原因', align:'center', width:100},
            {field:'thr', title:'退回人', align:'center', width:100},
            {field:'thrq', title:'退回时间', align:'center', width:100},
            {field:'dhrq', title:'到货日期', align:'center', width:100},
            {field:'createUser.xm', title:'计划员', align:'center', width:100},
            {field:'ph', title:'牌号', align:'center', width:100},
            {title:'设备材料', field:'sbcl', align:'center', formatter:function (value) {
                if (value == 'sb') {
                    return "设备";
                }
                if (value == "cl") {
                    return "材料";
                }
            }, width:100},
            {field:'bz', title:'备注', align:'center', width:100},
            {field:'bgjhhz.sm', title:'计划描述', align:'center', width:100},
            {field:'bgjhhz.jhsj', title:'计划日期', align:'center', width:100},
            {field:'gyzclrq', title:'提报日期', align:'center', width:100},
            {field:'gyzclr.xm', title:'提报人', align:'center', width:100},
            {field:'ywkclr.xm', title:'业务科处理人', align:'center', width:100},
            {field:'ywkclrq', title:'业务科处理日期', align:'center', width:100},
            {field:'sfcg', title:'导入状态', align:'center', formatter:function (value, row, index) {
                if (row.cgfs == 1) {
                    if (value == '0') {
                        return "未导入";
                    }
                    if (value == "1") {
                        return "已导入";
                    }
                } else {
                    return "";
                }
            }, width:100}
        ]
    ];

    var grid = $('#bgjhywk_grid').edatagrid({
        url:$.webPath() + '/jhgl/bgjhywk/bgjhywkList',
        toolbar:"#bgjhywk_toolbar",
        pagination:true,
        pageSize:50,
        rownumbers:true,
        checkOnSelect:false,
        selectOnCheck:false,
        singleSelect:true,
        collapsible:true,
        pageNumber:1,
        fit:true,
        fitColumns:false,
        queryParams:{
            status:$("#bgjhywk_toolbar [name='status']").val(),
            jhnf:$("#bgjhywk_toolbar [name='jhnf']").val()

        },
        frozenColumns:frozenwcColumns,
        columns:wclColumns,
        onClickRow:function (rowIndex, rowData) {
            datagridOnSelectHandle(rowIndex, rowData);
        },
        onLoadSuccess:function () {
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        }
    });
///===========================================
//==============此页面用到的函数===================
//===========================================

    //表格处在编辑状态的时候，给表单绑定事件
    function datagridOnSelectHandle(rowIndex, rowData) {
        //获取每个单元格
        $(grid).edatagrid('editRow', rowIndex);
        var editors = $(grid).datagrid('getEditors', rowIndex);
        if (editors.length == 0)
            return;
        /*var jhslEditor=editors[0];//计划数量
         $(jhslEditor.target).attr("readonly", "true");*/
        var rjslphEditor = editors[0]; //二级数量平衡
        $(rjslphEditor.target).attr("readonly", "true");
        var tjslEditor = editors[1]; //提交数量
        $(tjslEditor.target).attr("readonly", "true");
        //绑定事件
        //计算提交数量
        /* tjslEditor.target.unbind("blur").bind('blur', function () {
         $(tjslEditor.target).numberbox('setValue', rowData.jhsl-rowData.sl1-$(rjslphEditor.target).numberbox('getValue'));
         });*/

        //弹出物资编码树
        rjslphEditor.target.unbind("dblclick").bind('dblclick', function () {
            showBgjhywkDialog("二级平衡", $.webPath() + "/jhgl/bgjhywk/ywkejph?mxid=" + rowData["id"] + "&&dhckId=" + rowData["bgjhhz.dhck.id"]);
        });
    }

    //二级平衡弹出框
    function showBgjhywkDialog(title, href) {
        var win = $.window({
            title:title,
            width:1024,
            height:470,
            cache:false,
            url:href,
            modal:true,
            buttons:[
                {
                    text:'确定',
                    handler:function () {
                        var dhckId = $("#bgjhywk_dhck_id").val();
                        var bgjhhzmxId = $("#bgjhywk_bgjhhzmx_id").val();
                        $("#ywkejph_grid").edatagrid("saveRow");
                        var data = $("#ywkejph_grid").edatagrid("getData");
                        var ckIds = sumPropertyToString(data, 'ck.id');
                        var khIds = sumPropertyToString(data, 'kh.id');
                        var phsls = sumPropertyToString(data, 'phsl');
                        var sum = 0;
                        if (data.rows && data.rows.length > 0) {
                            for (var i = 0; i < data.rows.length; i++) {
                                if (temp != "") {
                                    var temp = parseFloat(data.rows[i]['phsl']);
                                    if (!isNaN(temp))
                                        sum += temp;
                                }
                            }
                        }
                        //=========
                        $.ajax({
                            url:$.webPath() + '/jhgl/bgjhywk/ejphzk',
                            dataType:'json',
                            type:'POST',
                            data:{ckIds:ckIds, khIds:khIds, phsls:phsls, dhckId:dhckId, bgjhhzmxId:bgjhhzmxId},
                            beforeSend:function () {
                                $("#bgjhywk_toolbar").mask();
                            },
                            success:function (data) {
                                $("#bgjhywk_toolbar").mask("hide");
                                if (data.statusCode == 200) {
                                    var row = $(grid).datagrid("getSelected");
                                    var rowIndex = $(grid).datagrid("getRowIndex", row);
                                    var editor = $(grid).datagrid('getEditor', {index:rowIndex, field:'sl2'});
                                    //   alert(sum);
                                    $(editor.target).val(sum);
                                    $('#bgjhywk_grid').datagrid('reload');
                                    $(win).dialog('close');
                                    $.messager.show({
                                        title:'提示',
                                        msg:data.message,
                                        timeout:3000,
                                        showType:'slide'
                                    });
                                }
                            }
                        });
                        //=============
                    }
                }
            ]
        });
    }
});

function sumPropertyToString(data, sx) {
    var property = "";
    for (var i = 0; i < data.rows.length; i++) {
        if (data.rows[i]['phsl'] != null) {
            property += (data.rows[i][sx] + ",");
        }
    }
    // alert(property);
    return   property;
}
